package com.aspose.cells.a.d.a.b;

import java.awt.geom.AffineTransform;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class zr extends zs {
   private int a;
   private byte[] b;

   public zr(int var1, float var2, int var3, float[] var4, AffineTransform var5) {
      ByteArrayOutputStream var6 = new ByteArrayOutputStream();
      com.aspose.cells.a.d.a.zb var7 = new com.aspose.cells.a.d.a.zb(var6, true);

      try {
         var7.b(var1);
         var7.writeFloat(var2);
         int var8 = var3 & 7;
         boolean var9 = var4 != null && var4.length > 0 || var8 == 1 || var8 == 3 || var8 == 4;
         int var10;
         if (!var9) {
            var10 = this.a(var3);
            if (var10 > -1) {
               this.a |= 6;
               var7.b(var10);
               var7.b(var10);
            }
         }

         switch(var3 & 12288) {
         case 0:
            this.a |= 8;
            var7.b(2);
            break;
         case 4096:
            this.a |= 8;
            var7.b(1);
         }

         if (var8 >= 1 && var8 <= 4) {
            this.a |= 32;
            var7.b(var8);
         }

         if (var9) {
            var10 = this.a(var3);
            if (var10 > -1) {
               this.a |= 64;
               var7.b(var10);
            }
         }

         if (var4 != null && var4.length > 0) {
            this.a |= 256;
            var7.b(var4.length);

            for(var10 = 0; var10 < var4.length; ++var10) {
               var7.writeFloat(var4[var10]);
            }
         }

         var7.flush();
      } catch (IOException var11) {
         throw new RuntimeException("Fail to create EmfPlusPenData", var11);
      }

      this.b = var6.toByteArray();
   }

   private int a(int var1) {
      switch(var1 & 768) {
      case 0:
         return 2;
      case 256:
         return 1;
      default:
         return -1;
      }
   }

   public int b() {
      return 16392;
   }

   public int c() {
      return 4 + this.b.length;
   }

   public int a(com.aspose.cells.a.d.a.zb var1) throws IOException {
      var1.b(this.a);
      var1.a(this.b);
      return 4 + this.b.length;
   }
}
